home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- ////////////////////////////////////////////////////////////////////////
- // SetupFields --
- ////////////////////////////////////////////////////////////////////////
- #ifndef SETUPFIELDS_H
- #define SETUPFIELDS_H
-
- #include "Database.h"
-
- #include "OkStr.h"
- #include "OkLabeledComponent.h"
- #include "OkText.h"
- #include "OkToggleButton.h"
-
- #include <Vk/VkGenericDialog.h>
- #include <Vk/VkOptionMenu.h>
-
-
- class SetupFields : public VkGenericDialog, public Persistent {
-
- public:
- enum Field { NONE=-1, NAME, PHONE1, PHONE2, FAX, MOBILE_PHONE, EMAIL,
- ADDRESS_LINE1, ADDRESS_LINE2, CITY, STATE, ZIP, COUNTRY, TOTAL_FIELDS };
-
- private:
- IntKey _key;
-
- static VkMenuDesc _fieldsDesc[];
-
- VkOptionMenu* _fieldsOptionMenu;
- OkLabeledComponent<OkText>* _fieldLabelWidget;
- OkLabeledComponent<OkText>* _fieldLenWidget;
- OkToggleButton* _showInListToggle;
-
- Field _prevField;
- void setup( Field f=NAME );
- void loadSavedValues();
- void saveCurrentValues();
- // Return FALSE if there is an illegal input.
- Boolean getCurrentUserInput( Field f );
- void populateWidgets( Field f );
-
- // Callback stubs.
- static void setupNameCB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( NAME ); }
- static void setupPhone1CB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( PHONE1 ); }
- static void setupPhone2CB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( PHONE2 ); }
- static void setupFaxCB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( FAX ); }
- static void setupMobilePhoneCB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( MOBILE_PHONE ); }
- static void setupEmailCB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( EMAIL ); }
- static void setupAddressLine1CB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( ADDRESS_LINE1 ); }
- static void setupAddressLine2CB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( ADDRESS_LINE2 ); }
- static void setupCityCB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( CITY ); }
- static void setupStateCB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( STATE ); }
- static void setupZipCB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( ZIP ); }
- static void setupCountryCB( Widget, XtPointer obj, XtPointer )
- { ((SetupFields *)obj)->setup( COUNTRY ); }
-
- // Internal data storage.
- Boolean _showInList[ TOTAL_FIELDS ];
- Boolean _newShowInList[ TOTAL_FIELDS ];
- OkStr _fieldLabel[ TOTAL_FIELDS ];
- OkStr _newFieldLabel[ TOTAL_FIELDS ];
- int _fieldLen[ TOTAL_FIELDS ];
- int _newFieldLen[ TOTAL_FIELDS ];
-
- protected:
- // Persistent functions.
- void Read();
- void Write();
-
- Widget createDialog( Widget );
- void apply(Widget, XtPointer); // (factory) Default btn.
- void ok(Widget, XtPointer);
- void cancel(Widget, XtPointer);
-
-
- public:
- SetupFields();
- ~SetupFields();
-
- void save();
- void setFactoryDefault();
- Boolean showInList( Field f ) const { return _showInList[ f ]; }
- const char* fieldLabel( Field f ) const { return _fieldLabel[ f ]; }
- int fieldLen( Field f ) const { return _fieldLen[ f ]; }
-
- };
-
- extern SetupFields* theSetupFields;
-
- #endif
-